import * as crypto from 'crypto'

export const sha256 = (data: string, inputEncoding, encoding) => {
  inputEncoding = inputEncoding || 'utf-8';
  encoding = encoding || 'hex';
  const hash = crypto.createHash('sha256')
  return hash.update(data, inputEncoding).digest(encoding)
}

export const sha1 = (data: string, inputEncoding, encoding) => {
  inputEncoding = inputEncoding || 'utf-8';
  encoding = encoding || 'hex';
  const hash = crypto.createHash('sha1')
  return hash.update(data, inputEncoding).digest(encoding)
}